<?php
if ($_POST['submit']){
	$seo = $_POST['seo'];
	foreach($seo as $k=>$a_l){
        $seo[$k]=strtolower($a_l);
    }
	$page_title='<title>'.$_POST['seo']['title']."</title>\r\n";
    $page_title.='<meta name="keywords" content="'.$_POST['seo']['keyword'].'" />'."\r\n";
    $page_title.='<meta name="description" content="'.$_POST['seo']['desc'].'" />'."\r\n";
	$pagetag=$seo['tag'];
	$code=template_parse(str_replace("\'","'",$page_title));
    file_put_contents(DDROOTPATH.'/cache/title/'.$pagetag.'_title.php',$code);
	insert_one_sql('seo',  $seo);
    echo mysql_error();
    echo alert('保存完成', '?act=lable&tag='.$seo['tag']);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>SEO后台管理</title>
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/system.css" rel="stylesheet" type="text/css" />
<link href="css/table_form.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="js/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="js/formvalidator.js" charset="UTF-8"></script>
</head>

<body>
<style type="text/css">
html{_overflow-y:scroll}
</style>
<script type="text/javascript">
$(document).ready(function() {
	$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg){}});
	$("#site_tag").formValidator({onshow:"请输入页面标签",onfocus:"用于获取变量",oncorrect:"必须设置正确"}).inputValidator({});
});
function insertText(id, text){
	var mystr = $('#'+id).val();
	$('#'+id).focus();
	$('#'+id).val(mystr + text);
}
</script>
<style>
.input-text{font-size:12px; font-family:'宋体';}.btn-l{color:#38E;border-bottom:2px #38E solid;text-decoration:none;}.red{color:#D30;border-color:#D30}
</style>
<div class="subnav">
  <div class="content-menu ib-a blue line-x"> <a ><em>
    <?=$seo["tag"]?>
    页面规则</em></a><span>|</span>请阅读提示进行设置
    <div id="callback" class="hidden pa" style="height:30px;top:13px;left:235px"></div>
  </div>
</div>
<div class="pad_10">
  <div class="explain-col"> 温馨提示：每个标题设置均有独立的标签, 不能在其他标题设置里使用. &nbsp; 标签设置错误将无法解析.<br />
    示例说明：<b><font color="blue">{$webtitle}-{$itemcatsname}-{$price}-{$page}-按{$sort}排序</font></b>, 必须保留完整不能修改.<br />
  </div>
  <div class="bk10"></div>
  <div class="col-tab">
    <div id="div_setting_1" class="contentList pad_10">
      <form name="myform" action="?act=add" method="post" id="myform">
        <table width="100%"  class="table_form">
          <tr>
            <th width="80">标签tag</th>
            <td><input type="text" name="seo[tag]" id="site_tag" size="25" class="input-text" style="width:400px" value="<?=$seo["tag"]?>" />必填选项</td>
          </tr>
          <tr>
            <th width="80">对应页面</th>
            <td><input type="text" name="seo[url]" id="site_url" size="25" class="input-text" style="width:400px" value="<?=$seo["url"]?>" /></td>
          </tr>
          <tr>
            <th>标题</th>
            <td><input type="text" name="seo[title]" id="title" size="25" class="input-text" style="width:95%" value="<?=$seo["title"]?>" /></td>
          </tr>
          <tr>
            <th>关键字</th>
            <td><input type="text" name="seo[keyword]" id="keyword" size="25" class="input-text" style="width:95%" value="<?=$seo[keyword]?>" /></td>
          </tr>
          <tr>
            <th>描述</th>
            <td><input type="text" name="seo[desc]" id="desc" size="25" class="input-text" style="width:95%" value="<?=$seo[desc]?>" /></td>
          </tr>
          <tr>
            <th>简便标签</th>
            <td><input type="text" name="seo[label]" id="desc" size="25" class="input-text" style="width:95%" value="<?=$seo[label]?>" /></td>
          </tr>
          <tr>
            <th></th>
            <td><span class="onCorrect">还有更高级的自定义标签规则设置, 请到论坛查看相关教程. &nbsp; [<a href="http://bbs.duoduo123.com" target="_blank"><u class="blue">点击进入论坛</u></a>]</span></td>
          </tr>
          <tr>
            <th></th>
            <td><input type="submit" name="submit" value="提交" class="button"></td>
          </tr>
        </table>
        <input type="hidden" name="seo[del]" id="desc" size="25" class="input-text" style="width:95%" value="0" />
      </form>
      <div class="bk15"></div>
    </div>
  </div>
</div>
</body>
</html>